import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";


Vue.use(VueRouter);

// 解决两次访问相同路由地址报错
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const routes = [
  {
    path: "/",
    name: "home",
    component: Home,
  },
];

const router = new VueRouter({
  mode: "hash",
  base: "/",
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes,
});

export default router;
